#include<iostream>
using namespace std;
typedef long long LL;
LL n;
const int N = 1e4 + 10;
LL a[N][N];
pair<int, int> t[N];
int main()
{
	cin >> n;
	int x = (n - 1) / 2;
	a[0][x] = 1;
	t[1] = { 0,x };
	for (int i = 2;i <= n * n;i++)
	{
		if (t[i - 1].first == 0 && t[i - 1].second != n - 1)
		{
			a[n - 1][t[i - 1].second + 1] = i;
			t[i] = { n - 1,t[i - 1].second + 1 };
		}
		else if (t[i - 1].second == n - 1 && t[i - 1].first != 0)
		{
			a[t[i - 1].first - 1][0] = i;
			t[i] = { t[i - 1].first - 1,0 };
		}
		else if (t[i - 1].first == 0 && t[i - 1].second == n - 1)
		{
			a[t[i - 1].first + 1][t[i - 1].second] = i;
			t[i] = { t[i - 1].first + 1,t[i - 1].second };
		}
		else if (t[i - 1].first != 0 && t[i - 1].second != n - 1)
		{
			if (a[t[i - 1].first - 1][t[i - 1].second + 1] == 0)
			{
				a[t[i - 1].first - 1][t[i - 1].second + 1] = i;
				t[i] = { t[i - 1].first - 1,t[i - 1].second + 1 };
			}
			else
			{
				a[t[i - 1].first + 1][t[i - 1].second] = i;
				t[i] = { t[i - 1].first + 1,t[i - 1].second };
			}
		}
	}
	for (int i = 0;i < n;i++)
	{
		for (int j = 0;j < n;j++)
		{
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}